home *** CD-ROM | disk | FTP | other *** search
/ Personal Computer World 2009 February / PCWFEB09.iso / Software / Linux / SLAX 6.0.8 / slax-6.0.8.iso / slax / base / 006-devel.lzm / usr / include / mimelib / text.h < prev    next >
Encoding:
C/C++ Source or Header  |  2007-05-14  |  5.8 KB  |  152 lines

  1. //=============================================================================
  2. // File:       text.h
  3. // Contents:   Declarations for DwText
  4. // Maintainer: Doug Sauder <dwsauder@fwb.gulf.net>
  5. // WWW:        http://www.fwb.gulf.net/~dwsauder/mimepp.html
  6. //
  7. // Copyright (c) 1996, 1997 Douglas W. Sauder
  8. // All rights reserved.
  9. //
  10. // IN NO EVENT SHALL DOUGLAS W. SAUDER BE LIABLE TO ANY PARTY FOR DIRECT,
  11. // INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT OF
  12. // THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF DOUGLAS W. SAUDER
  13. // HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  14. //
  15. // DOUGLAS W. SAUDER SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING, BUT
  16. // NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
  17. // PARTICULAR PURPOSE.  THE SOFTWARE PROVIDED HEREUNDER IS ON AN "AS IS"
  18. // BASIS, AND DOUGLAS W. SAUDER HAS NO OBLIGATION TO PROVIDE MAINTENANCE,
  19. // SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
  20. //
  21. //=============================================================================
  22.  
  23. #ifndef DW_TEXT_H
  24. #define DW_TEXT_H
  25.  
  26. #ifndef DW_CONFIG_H
  27. #include <mimelib/config.h>
  28. #endif
  29.  
  30. #ifndef DW_STRING_H
  31. #include <mimelib/string.h>
  32. #endif
  33.  
  34. #ifndef DW_FIELDBDY_H
  35. #include <mimelib/fieldbdy.h>
  36. #endif
  37.  
  38. //=============================================================================
  39. //+ Name DwText -- Class representing text in a RFC-822 header field-body
  40. //+ Description
  41. //. {\tt DwText} represents an unstructured field body in a header field.
  42. //. It roughly corresponds to the {\it text} element of the BNF grammar
  43. //. defined in RFC-822.
  44. //=============================================================================
  45. // Last modified 1997-07-30
  46. //+ Noentry ~DwText sClassName _PrintDebugInfo
  47.  
  48.  
  49. class DW_EXPORT DwText : public DwFieldBody {
  50.  
  51. public:
  52.  
  53.     DwText();
  54.     DwText(const DwText& aText);
  55.     DwText(const DwString& aStr, DwMessageComponent* aParent=0);
  56.     //. The first constructor is the default constructor, which sets the
  57.     //. {\tt DwText} object's string representation to the empty string
  58.     //. and sets its parent to NULL.
  59.     //.
  60.     //. The second constructor is the copy constructor, which copies the
  61.     //. string representation from {\tt aText}.
  62.     //. The parent of the new {\tt DwText} object is set to NULL.
  63.     //.
  64.     //. The third constructor copies {\tt aStr} to the {\tt DwText}
  65.     //. object's string representation and sets {\tt aParent} as its parent.
  66.     //. The virtual member function {\tt Parse()} should be called immediately
  67.     //. after this constructor in order to parse the string representation.
  68.     //. Unless it is NULL, {\tt aParent} should point to an object of a class
  69.     //. derived from {\tt DwField}.
  70.  
  71.     virtual ~DwText();
  72.  
  73.     const DwText& operator = (const DwText& aText);
  74.     //. This is the assignment operator.
  75.  
  76.     virtual void Parse();
  77.     //. This virtual member function is inherited from
  78.     //. {\tt DwMessageComponent}, where it is declared a pure virtual
  79.     //. function.  For a {\tt DwText} object, this member function does
  80.     //. nothing, since {\tt DwText} represents an unstructured field body
  81.     //. (like the Subject header field) that does not have a broken-down
  82.     //. form.
  83.     //.
  84.     //. Note, however, that this function should still be called consistently,
  85.     //. since a subclass of {\tt DwText} may implement a parse method.
  86.     //.
  87.     //. This function clears the is-modified flag.
  88.  
  89.     virtual void Assemble();
  90.     //. This virtual member function is inherited from
  91.     //. {\tt DwMessageComponent}, where it is declared a pure virtual
  92.     //. function.  For a {\tt DwText} object, this member function does
  93.     //. nothing, since {\tt DwText} represents an unstructured field body
  94.     //. (like the Subject header field) that does not have a broken-down
  95.     //. form.
  96.     //.
  97.     //. Note, however, that this function should still be called consistently,
  98.     //. since a subclass of {\tt DwText} may implement an assemble method.
  99.     //.
  100.     //. This function clears the is-modified flag.
  101.  
  102.     virtual DwMessageComponent* Clone() const;
  103.     //. This virtual function, inherited from {\tt DwMessageComponent},
  104.     //. creates a new {\tt DwText} on the free store that has the same
  105.     //. value as this {\tt DwText} object.  The basic idea is that of
  106.     //. a ``virtual copy constructor.''
  107.  
  108.     static DwText* NewText(const DwString& aStr, DwMessageComponent* aParent);
  109.     //. Creates a new {\tt DwText} object on the free store.
  110.     //. If the static data member {\tt sNewText} is NULL,
  111.     //. this member function will create a new {\tt DwText}
  112.     //. and return it.  Otherwise, {\tt NewText()} will call
  113.     //. the user-supplied function pointed to by {\tt sNewText},
  114.     //. which is assumed to return an object from a class derived from
  115.     //. {\tt DwText}, and return that object.
  116.  
  117.     //+ Var sNewText
  118.     static DwText* (*sNewText)(const DwString&, DwMessageComponent*);
  119.     //. If {\tt sNewText} is not NULL, it is assumed to point to a
  120.     //. user-supplied function that returns an object from a class derived from
  121.     //. {\tt DwText}.
  122.  
  123. private:
  124.  
  125.     static const char* const sClassName;
  126.  
  127. public:
  128.  
  129.     virtual void PrintDebugInfo(std::ostream& aStrm, int aDepth=0) const;
  130.     //. This virtual function, inherited from {\tt DwMessageComponent},
  131.     //. prints debugging information about this object to {\tt aStrm}.
  132.     //. It will also call {\tt PrintDebugInfo()} for any of its child
  133.     //. components down to a level of {\tt aDepth}.
  134.     //.
  135.     //. This member function is available only in the debug version of
  136.     //. the library.
  137.  
  138.     virtual void CheckInvariants() const;
  139.     //. Aborts if one of the invariants of the object fails.  Use this
  140.     //. member function to track down bugs.
  141.     //.
  142.     //. This member function is available only in the debug version of
  143.     //. the library.
  144.  
  145. protected:
  146.  
  147.     void _PrintDebugInfo(std::ostream& aStrm) const;
  148.  
  149. };
  150.  
  151. #endif
  152.